SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

create procedure dbo.DnnProduct_GetUrlLog

@URLTrackingID int,
@StartDate     datetime,
@EndDate       datetime

as

select dbo.DnnProduct_UrlLog.*,
       'FullName' = dbo.DnnProduct_Users.FirstName + ' ' + dbo.DnnProduct_Users.LastName
from   dbo.DnnProduct_UrlLog
inner join dbo.DnnProduct_UrlTracking on dbo.DnnProduct_UrlLog.UrlTrackingId = dbo.DnnProduct_UrlTracking.UrlTrackingId
left outer join dbo.DnnProduct_Users on dbo.DnnProduct_UrlLog.UserId = dbo.DnnProduct_Users.UserId
where  dbo.DnnProduct_UrlLog.UrlTrackingID = @UrlTrackingID
and    ((ClickDate >= @StartDate) or @StartDate is null)
and    ((ClickDate <= @EndDate) or @EndDate is null)
order by ClickDate









GO
